package MediaEntity;

import javafx.scene.media.Media;

import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;
import java.io.File;
import java.io.IOException;
import java.util.Comparator;

public class MediaEntity {
    protected Media media;
    protected long fulltime;
    protected String album;
    protected String artist;
    protected String name;
    protected String filePath;


    //判断文件类型的类方法，可根据返回值选择对应文件的子类构造函数
    public static String getVideoFormat(String path){
        return  path.toLowerCase().substring(path.toLowerCase().lastIndexOf(".") + 1);
    }


    public MediaEntity(){
        fulltime=0;
        album="未知";
        artist="未知";
        name="未知";
    }

    public Media getMedia() {
        return media;
    }

    public long getFulltime() {
        return fulltime;
    }

    public String getAlbum() {
        return album;
    }

    public String getName() {
        return name;
    }

    public String getArtist() {
        return artist;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "MediaEntity{" +
                "media=" + media +
                ", fulltime=" + fulltime +
                ", album='" + album + '\'' +
                ", artist='" + artist + '\'' +
                ", name='" + name + '\'' +
                ", filePath='" + filePath + '\'' +
                '}';
    }
}
